Fix allocation of the error_description fields.
authorEwan Mellor <ewan@xensource.com>
Wed, 21 Feb 2007 00:04:06 +0000 (00:04 +0000)
committerEwan Mellor <ewan@xensource.com>
Wed, 21 Feb 2007 00:04:06 +0000 (00:04 +0000)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/libxen/src/xen_common.c

index 8c5feeb33f26baf491a3cc56eed47e8a733146b2..c6e21818506ec605daa8fa2434cc51f1588e3d88 100644 (file)
@@ -989,10 +989,10 @@ static void parse_failure(xen_session *session, xmlNode *node)
         char **c = (char **)error_descriptions->contents;
         int n = error_descriptions->size;
 
-        char **strings = malloc(3 * sizeof(char *));
+        char **strings = malloc(n * sizeof(char *));
         for (int i = 0; i < n; i++)
         {
-            strings[i] = xen_strdup_(c[i]);
+            strings[i] = c[i];
         }
 
         session->error_description_count = n;